import request from '@/config/axios'

// 车主报案信息 VO
export interface OwnerItemVO {
  id: number // id
  ownerId: number // 车主id
  reportDate: Date // 报案时间
  reportNum: string // 报案号
  reportAddress: string // 报案地址
  reportInfo: string // 报案详情
  damagedPart: string // 受损部位
  consult: string // 参考损失
  status: boolean // 审核状态
  installNum: number // 安装次数
  installInfo: string // 安装详情
  auditResult: string // 审核结果
  reason: string // 驳回原因
  auditId: number // 审核人id
}

// 车主报案信息 API
export const OwnerItemApi = {
  // 查询车主报案信息分页
  getOwnerItemPage: async (params: any) => {
    return await request.get({ url: `/erp/owner-item/main-page`, params })
  },

  // 查询车主报案信息详情
  getOwnerItem: async (id: number) => {
    return await request.get({ url: `/erp/owner-item/get?id=` + id })
  },
  //获取报修历史记录
  getHistory: async (params) => {
    return await request.get({url: `/erp/owner-item/get-ownerId`, params})
  },
  //更新状态
  updateState: async (params) => {
    return await request.put({url: `/erp/owner-item/update-status`, params})
  },

  // 新增车主报案信息
  createOwnerItem: async (data: OwnerItemVO) => {
    return await request.post({ url: `/erp/owner-item/create`, data })
  },

  // 修改车主报案信息
  updateOwnerItem: async (data: OwnerItemVO) => {
    return await request.put({ url: `/erp/owner-item/update`, data })
  },

  // 删除车主报案信息
  deleteOwnerItem: async (id: number) => {
    return await request.delete({ url: `/erp/owner-item/delete?id=` + id })
  },

  // 导出车主报案信息 Excel
  exportOwnerItem: async (params) => {
    return await request.download({ url: `/erp/owner-item/export-excel`, params })
  }
}